﻿@using AC.Service.DTO.Blog
@using AC.Util
@model wychuan2.com.Areas.admin.Models.Blog.SectionListModel
@{
    ViewBag.Title = "段落-列表";
    Layout = "../Shared/_Layout.cshtml";
}

@{
    string strCategories = JsonHelper.ToJson(Model.Categories);
    string strTags = JsonHelper.ToJson(Model.Tags);

    List<BlogCategoryDTO> lstFirsts = Model.Categories.Where(c => c.ParentId == 0).ToList();

}

@section styles{
<link href="~/Content/plugins/chosen/chosen.css" rel="stylesheet" />
<style type="text/css">
    .content11 {
        width: 500px;
        overflow: hidden;
        white-space: nowrap;
        text-overflow: ellipsis;
    }
</style>
}
<div class="row">
    <div class="col-lg-12 col-md-12 col-sm-12">
        <div class="ibox">
            <div class="ibox-title">
                <h5>所有段落</h5>
                <div class="ibox-tools">
                    <a href="/admin/section" class="btn btn-primary btn-xs">发布段落</a>
                </div>
            </div>
            <div class="ibox-content">
                <div class="row m-b-sm m-t-sm">
                    <div class="col-md-4">
                        <div class="input-group">
                            <select class="form-control" name="selFirstCategoryQ">
                                <option value="">一级类目</option>
                                @foreach (var first in lstFirsts)
                                {
                                    <option value="@first.Id">@first.Name</option>
                                }
                            </select>
                            <span class="input-group-addon">-</span>
                            <select class="form-control" name="selSecondCategoryQ">
                                <option value="">二级类目</option>
                            </select>
                        </div>
                    </div>

                    <div class="col-md-6">
                        <div class="input-group">
                            <select id="selTagsQ" data-placeholder="所有Tag" class="chosen-select" multiple>
                                <option value="">请选择Tag</option>
                                @foreach (var tag in Model.Tags)
                                {
                                    <option value="@tag.Id" hassubinfo="true">@tag.TagName</option>
                                }
                            </select>
                        </div>
                    </div>
                    <div class="col-md-2">
                        <button class="btn btn-primary" type="button" id="btnSearch" value="查询">查询</button>
                    </div>
                </div>
                <div id="content">
                    @Html.Partial("_SectionList",Model)
                </div>
                <div class="row">
                    <div class="col-sm-6">
                        <div data-pagesize="@Model.PagedSections.PageSize" data-totalrecord="@Model.PagedSections.RecordCount" class="dataTables_info">
                            显示 <span name="pageStart"></span> 到 <span name="pageEnd"></span> 项，共 <span name="pageTotal"></span> 项
                        </div>
                    </div>
                    <div class="col-sm-6">
                        <div class="dataTables_paginate">
                            <ul class="pagination"></ul>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>

@section scripts{
<script type="text/javascript" src="~/Scripts/bootstrap-paginator.js"></script>
<script src="~/Scripts/plugins/chosen/chosen.jquery.js"></script>
<script src="~/Scripts/mvcParamMatch.js"></script>
    <script type="text/javascript">
        var pager = {
            pageIndex: @Model.PagedSections.PageIndex,
            pageSize: @Model.PagedSections.PageSize,
            totalRecord: @Model.PagedSections.RecordCount,
            totalPageCount: @(Model.PagedSections.PageCount==0?1:Model.PagedSections.PageCount)
        };
        window.categories = @Html.Raw(strCategories);
        window.tags = @Html.Raw(strTags);
    </script>
    <script src="~/Scripts/blog/sectionlist.js"></script>
}